package cn.linkey.rulelib.YTH;

import com.alibaba.fastjson.JSON;
import com.asiainfo.zbPMS30.namelist.ws.PmsProjectServicesSrv.MsgHeader;
import com.asiainfo.zbPMS30.namelist.ws.PmsProjectServicesSrv.PmsProjectServicesSrv;
import com.asiainfo.zbPMS30.namelist.ws.PmsProjectServicesSrv.PmsProjectServicesSrvImplService;
import com.asiainfo.zbPMS30.namelist.ws.PmsProjectServicesSrv.ProjectResponseBean;
import com.asiainfo.zbPMS30.namelist.ws.PmsProjectServicesSrv.ProjectSelectBean;

public class Main {

	private static final String httpProxyHost = "132.121.80.201";

	private static final String httpProxyPort = "38080";

	private static void setHttpProxy() {
		System.setProperty("http.proxyHost", httpProxyHost);
		System.setProperty("http.proxyPort", httpProxyPort);
		System.setProperty("http.proxySet", "true");
	}
//	wsimport  -keep -p  com.asiainfo.pms3.downstream http://10.0.209.69:8380/pms-service/services/BuildingDataPushService?wsdl
	public enum Env {
		Devlepment(
				// pms30ZbHxWsdlLocation
				"http://10.0.209.69:8580/pms-jtmdz/services/PmsGdServicesSrv?wsdl",
				// pms30ZbHxProjectWsdlLocation
				"http://10.0.209.69:8580/pms-jtmdz/services/PmsProjectServicesSrv?wsdl",
				// pms30ZbHxSourcesystemid
				"4401",
				// pms30ZbHxSourcesystemname
				"广东一体化运营平台"),
				//
				Product(
						// pms30ZbHxWsdlLocation
						"http://10.0.209.69:8580/pms-jtmdz/services/PmsGdServicesSrv?wsdl",
						// pms30ZbHxProjectWsdlLocation
						"http://10.0.209.69:8580/pms-jtmdz/services/PmsProjectServicesSrv?wsdl",
						// pms30ZbHxSourcesystemid
						"2018022844901",
						// pms30ZbHxSourcesystemname
						"广东一体化运营平台");

		private final String pms30ZbHxWsdlLocation;
		private final String pms30ZbHxProjectWsdlLocation;
		private final String pms30ZbHxSourcesystemid;
		private final String pms30ZbHxSourcesystemname;

		private Env(String pms30ZbHxWsdlLocation, String pms30ZbHxProjectWsdlLocation, String pms30ZbHxSourcesystemid, String pms30ZbHxSourcesystemname) {
			this.pms30ZbHxWsdlLocation = pms30ZbHxWsdlLocation;
			this.pms30ZbHxProjectWsdlLocation = pms30ZbHxProjectWsdlLocation;
			this.pms30ZbHxSourcesystemid = pms30ZbHxSourcesystemid;
			this.pms30ZbHxSourcesystemname = pms30ZbHxSourcesystemname;
		}

		public String getPms30ZbHxWsdlLocation() {
			return pms30ZbHxWsdlLocation;
		}

		public String getPms30ZbHxProjectWsdlLocation() {
			return pms30ZbHxProjectWsdlLocation;
		}

		public String getPms30ZbHxSourcesystemid() {
			return pms30ZbHxSourcesystemid;
		}

		public String getPms30ZbHxSourcesystemname() {
			return pms30ZbHxSourcesystemname;
		}

	}

	public static void main(String[] args) throws Exception {
		if (args.length == 1 && "proxy".equals(args[0])) {
			System.err.println("java http proxy");
			setHttpProxy();
		}
		Env env = Env.Devlepment;
		PmsProjectServicesSrv ser = new PmsProjectServicesSrvImplService().getPmsProjectServicesSrvImplPort();
		MsgHeader msgHeader = new MsgHeader();
		msgHeader.setSourceSystemId(env.getPms30ZbHxSourcesystemid());
		msgHeader.setSourceSystemName(env.getPms30ZbHxSourcesystemname());
		test002(ser, msgHeader);
	}

	private static void test002(PmsProjectServicesSrv ser, MsgHeader msgHeader) {
		ProjectSelectBean req2 = new ProjectSelectBean() {
			{
				setProv("4401");
				setCity("4402");
				setSpecC("5E");
			}
		};
		System.err.println();
		ProjectResponseBean projectList = ser.getProjectList(msgHeader, req2);
		p("msgHeader", msgHeader);
//		p("req2", req2);
		p("result", projectList);
	}

	public static void p(String h, Object p) {
		System.err.println("======= " + h + " =======\t" + JSON.toJSONString(p));
	}
}